package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.ysd.entity.XinWenFenLei;
import com.ysd.util.DBManager;

public class XinWenFenLeiDaoImpl {
	public List<XinWenFenLei> getXinWenFenLei(){
		List<XinWenFenLei> XinWenFenLei = new ArrayList<XinWenFenLei>();
		Connection conn =DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		XinWenFenLei xinWenFenLei = null;
		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from xinWenfenLei");
			while(rs.next()) {
				int xinWenFenLeiId = rs.getInt("xinWenFenLeiId");
				String xinWenMingCheng = rs.getString("xinWenMingCheng");
				xinWenFenLei = new XinWenFenLei(xinWenFenLeiId, xinWenMingCheng);
				XinWenFenLei.add(xinWenFenLei);
			}
			return XinWenFenLei;
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		}
	}
}
